package com.cwz.api.remote;

import com.cwz.api.entity.SysLogininfor;
import com.cwz.api.entity.SysOperLog;
import com.cwz.api.factory.RemoteLogFallbackFactory;
import com.cwz.core.constant.SecurityConstants;
import com.cwz.core.constant.ServiceNameConstants;
import com.cwz.core.result.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * @program: w-demo
 * @description: 日志服务 feign
 * @author: Wen
 **/
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService {
	/**
	 * @Description: 保存系统日志
	 * @Author: Wen
	 * @param sysOperLog:	系统日志实体
	 * @param source:		请求来源
	 * @return: com.cwz.core.result.R<java.lang.Boolean>
	 **/
	@PostMapping("/operlog")
	public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

	/**
	 * @Description: 保存访问记录
	 * @Author: Wen
	 * @param sysLogininfor:	访问日志实体
	 * @param source:			请求来源
	 * @return: com.cwz.core.result.R<java.lang.Boolean>
	 **/
	@PostMapping("/logininfor")
	public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
